# -*- coding: utf-8 -*-
"""
Basic Translation
=================

    >>> import googlelanguage

Simple first translation

    >>> print googlelanguage.translate(
    ...     sentence='Hello world',
    ...     from_lang='en',
    ...     to_lang='pt',
    ...     )
    Olá mundo

Default 'from' language must be english

    >>> print googlelanguage.translate(
    ...     sentence='Hello world',
    ...     to_lang='pt',
    ...     )
    Olá mundo

Default 'to' language must be english

    >>> print googlelanguage.translate(
    ...     sentence='Olá mundo',
    ...     from_lang='pt',
    ...     )
    Hello world

Transloation with language detection

    >>> print googlelanguage.translate(
    ...     sentence='Olá mundo',
    ...     from_lang='',
    ...     )
    Hello world

Translation between non-english languages

    >>> print googlelanguage.translate(
    ...     sentence='Olá mundo',
    ...     from_lang='pt',
    ...     to_lang='it',
    ...     )
    Ciao mondo

Translation with full_return

    >>> type(googlelanguage.translate(
    ...     sentence='Olá mundo',
    ...     from_lang='pt',
    ...     to_lang='it',
    ...     full_return=True,
    ...     ))
    <type 'dict'>

Invalid language

    >>> try:
    ...     googlelanguage.translate(
    ...         sentence='Olá mundo',
    ...         from_lang='xx',
    ...         to_lang='it',
    ...     )
    ... except Exception, e:
    ...     print e
    (400) invalid translation language pair

Invalid sentence

    >>> print googlelanguage.translate(
    ...     sentence='Olulu mundoxx',
    ...     from_lang='pt',
    ...     to_lang='en',
    ...     )
    Olulu mundoxx

Language detection

    >>> print googlelanguage.detect_language('Ciao mondo')
    it

Invalid language detection

    >>> 'it' != googlelanguage.detect_language('Cixxxxao mon998do')
    True

Language detection with full_return

    >>> type(googlelanguage.detect_language('Ciao mondo', full_return=True))
    <type 'dict'>
"""

if __name__ == '__main__':
    import doctest
    doctest.testmod()

